import request from '@/utils/request'

export function getMember(query) {
	return request({
		url: "/api/member/list",
		method: "POST",
		data: query
	})
}

export function updateMemberType(id, status) {
	let query = {
		status: status
	}
	return request({
		url: `/api/member/change/status/${id}`,
		method: "GET",
		params: query
	})
}

export function getMemberDetail(id) {
	return request({
		url: `/api/member/detail/${id}`,
		method: "GET"
	})
}

export function getMemberOrderInfo(id) {
	return request({
		url: `/api/member/order/detail/${id}`,
		method: "GET"
	})
}

export function getMemberAddress(id) {
	return request({
		url: `/api/member/addresses/${id}`,
		method: "GET"
	})
}

export function getMemberOrders(id) {
	return request({
		url: `/api/member/pay/orders/${id}`,
		method: "GET"
	})
}

export function getMemberCoupon(id, msg) {
	let query = new FormData();
	if(msg.couponName != undefined){
		query.append("couponName", msg.couponName)
	}
	if(msg.couponName != undefined){
		query.append("overTime", msg.overTime)
	}
	return request({
		headers: {
			"Content-Type": "multipart/form-data"
		},
		url: `/api/member/coupon/histories/${id}`,
		method: "POST",
		data: query
	})
}
